package com.yang.lesson01;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.time.Period;

public class TestZuoYe {
    public static void main(String[] args) {
        Frame frame = new Frame();
        frame.setLayout(new GridLayout(2,1));
        frame.setBackground(Color.pink);
        frame.setBounds(200,200,600,400);
        frame.setVisible(true);

        Panel panel1 = new Panel();
        Panel panel2 = new Panel();
        Panel panel3 = new Panel();
        Panel panel4 = new Panel();

        panel1.setLayout(new BorderLayout());
        panel2.setLayout(new GridLayout(2,1));
        panel3.setLayout(new BorderLayout());
        panel4.setLayout(new GridLayout(2,2));


        panel1.add(new Button("btn1"),BorderLayout.WEST);
        panel1.add(new Button("btn2"),BorderLayout.EAST);
        panel2.add(new Button("btn3"));
        panel2.add(new Button("btn4"));

        panel3.add(new Button("btn5"),BorderLayout.WEST);
        panel3.add(new Button("btn6"),BorderLayout.EAST);
        for (int i = 0; i < 4; i++) {
            panel4.add(new Button("button"+i));
        }

        panel1.add(panel2);
        panel3.add(panel4);
        frame.add(panel1);
        frame.add(panel3);


        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }
}
